package br.com.gc.wrappers;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public class TesteDate {

	public static void main(String[] args) {
	
		//Locale.setDefault(Locale.CHINA);
		
		//Date now = new Date(1);
		
		Date now = new Date();
		
		//java.text formatação de data
		//
		SimpleDateFormat format3= new SimpleDateFormat();
		//System.out.println(format3.format(now));
		
		//
		SimpleDateFormat format = new SimpleDateFormat("dd MMMM yyyy", Locale.ENGLISH);
		//System.out.println(format.format(now));
		
		//
		SimpleDateFormat format2 = new SimpleDateFormat("dd 'de' MMMM 'de' yyyy", Locale.ENGLISH);
		//System.out.println(format2.format(now));
		
		//
		SimpleDateFormat format4 = new SimpleDateFormat("dd/MM/yyyy");
		String txtDate = "29/08/2012";
		Date date = null;
		try {
			date = format4.parse(txtDate);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		
		//System.out.println(date);
		
		//
		Date date2 = null;
		SimpleDateFormat format5 = new SimpleDateFormat("dd/MM/yyyy");
		String txtDate2 = "29/08/2012";
		try {
			format5.setLenient(false);
			date2 = format5.parse(txtDate2);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date2);
		calendar.set(Calendar.MONTH, Calendar.NOVEMBER);
		calendar.add(Calendar.DAY_OF_MONTH,40);
		//System.out.println(date2);
		
		Date newDate = calendar.getTime();
		//System.out.println(newDate);
		
		SimpleDateFormat frmt = new SimpleDateFormat("EEEE',' dd 'de' MMMMM',' yyyy");
		
		//System.out.println(frmt.format(newDate));
		//System.out.println(frmt.format(date2));
		
		NumberFormat nf = NumberFormat.getCurrencyInstance();
		//System.out.println(nf.format(343546.34));
		//System.out.println(NumberFormat.getCurrencyInstance(Locale.US).format(1232131.2321));
		//System.out.println(NumberFormat.getCurrencyInstance(Locale.FRANCE).format(1232131.2321));
		//System.out.println(NumberFormat.getCurrencyInstance(Locale.JAPAN).format(1232131.2321));
		
		//FORMAÇÃO
		DecimalFormat df = new DecimalFormat("0000000000");
		System.out.println(df.format(123));
				
		DecimalFormat df2 = new DecimalFormat("0.000");
		System.out.println(df2.format(123.1));
		
		//Convenção Java
		// dd
		// MM
		// yy ou yyy
		
		//System.out.println(now);
		
		
	}
	
}
